Geo Spatial Inference Points :
References :
Ann Arbor Pizza Restaurants Inference Points :
References :
Detroit’s Pizza Restaurants Inference Points
References :
Chicago’s Pizza Restaurants Inference Points
References :
Inference Points :
References :
Inference Points :
References :
Inference Points :
References :
---
title: "Customer Sentiments Analysis Dashboard"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
runtime: shiny
logo: Logo.png
storyboard: true
social: menu
source: embed
theme: spacelab
---
```{r setup, include=FALSE}
library(flexdashboard)
require(tidyverse)
require(httr)
require(jsonlite)
require(rlist)
require(stringr)
require(sqldf)
require(ggplot2)
require(beeswarm)
require(googleway)
require(highcharter)
require(quantmod)
require(leaflet)
require(shiny)
require(bslib)
require(plotly)
require(dygraphs)
require(treemap)
require(DT)
require(romato)
df_keys <- read.csv(file = '/Users/Abs/Documents/GitHub/R Sample Codes/R-Codes/keys.csv')
df_yelp <- df_keys[grepl('\\Yelp', df_keys$name),]
df_zomato <- df_keys[grepl('\\Zomato', df_keys$name),]
client_id <- as.character(df_yelp$id)
client_secret <- as.character(df_yelp$key)
res <- POST("https://api.yelp.com/oauth2/token",
body = list(grant_type = "client_credentials",
client_id = client_id,
client_secret = client_secret))
token <- content(res)$access_token
yelp <- "https://api.yelp.com"
location <- "Chicago, IL"
categories <- NULL
limit <- 50
radius <- 8800
term <- "Pizza"
url <- modify_url(yelp, path = c("v3", "businesses", "search"),
query = list(term = term, location = location,
limit = limit,
radius = radius))
res <- GET(url, add_headers('Authorization' = paste("bearer", client_secret)))
results <- content(res)
yelp_httr_parse <- function(x) {
parse_list <- list(id = x$id,
name = x$name,
rating = x$rating,
review_count = x$review_count,
latitude = x$coordinates$latitude,
longitude = x$coordinates$longitude,
address1 = x$location$address1,
city = x$location$city,
state = x$location$state,
distance = x$distance)
parse_list <- lapply(parse_list, FUN = function(x) ifelse(is.null(x), "", x))
df <- tibble(id=parse_list$id,
name=parse_list$name,
rating = parse_list$rating,
review_count = parse_list$review_count,
latitude=parse_list$latitude,
longitude = parse_list$longitude,
address1 = parse_list$address1,
city = parse_list$city,
state = parse_list$state,
distance= parse_list$distance)
df
}
results_list <- lapply(results$businesses, FUN = yelp_httr_parse)
business_data <- do.call("rbind", results_list)
#write.table(business_data, "/Users/Abs/Documents/GitHub/R Sample Codes/R-Codes/analysis.csv",
# append = TRUE,
# sep = ",",
# col.names = FALSE,
# row.names = FALSE,
# quote = FALSE)
df_new <- read.csv(file = '/Users/Abs/Documents/GitHub/R Sample Codes/R-Codes/analysis.csv')
my_data <- as_tibble(df_new)
df_good <- my_data %>% filter(rating > 3.5)
zmt <- zomato$new(api_key = as.character(df_zomato$key))
pizza_blr <- zmt$search(query = "Pizza", lat = 12.972442, lon = 77.580643)
pizza_aus <- zmt$search(query = "Pizza", lat = -33.865143, lon = 151.209900)
```
### Location Markers across Midwest for Domino's Pizza Store featuring Yelp Ratings
```{r}
leaflet(df_new) %>%
addTiles() %>%
addCircles(lng =df_new$longitude, lat = df_new$latitude, weight = 2,
radius = df_new$review_count*1, popup=paste(df_new$name," - ",df_new$address1,",",df_new$city," , rating :",df_new$rating," review : ",df_new$review_count)
)
```
***
Geo Spatial Inference Points :
- Pizza restaurants analysis for 3 cities : Chicago, Detroit & Ann Arbor
- Jolly Pumpkin Cafe at Ann Arbor has 902 reviews with 4 rating
- Chicago's Pequod's Pizzeria has 335 reviews with 4 rating
\
References :
- [Yelp API](https://www.yelp.com/developers/documentation/v3)
- [leaflet visual](http://rstudio.github.io/leaflet/shapes.html)
### Overall distribution of customer reviews across Ann Arbor Restaurants
```{r}
df_annarbor <- df_good[grepl('\\Ann Arbor', df_good$city),]
hchart(df_annarbor, "scatter", hcaes(x = review_count, y = rating, z = review_count, group = name))
```
***
Ann Arbor Pizza Restaurants Inference Points :
- Jolly Pumpkin Cafe at Ann Arbor has 902 reviews with 4 rating
- NeoPapalis has 313 reviews, however has 4.5 rating
\
References :
- [Yelp API](https://www.yelp.com/developers/documentation/v3)
- [Highcharter](https://jkunst.com/highcharter/)
### Overall distribution of customer reviews across Detroit Restaurants
```{r}
df_detroit <- df_good[grepl('\\Detroit', df_good$city),]
hchart(df_detroit, "scatter", hcaes(x = review_count, y = rating, z = review_count, group = name))
```
***
Detroit's Pizza Restaurants Inference Points
- Detroit's Supino Pizzeria has 882 reviews with 4.5 rating, followed by Giovanni Ristorante
- Ottawa Via is second most in terms of reviews : 664 , with rating 4
\
References :
- [Yelp API](https://www.yelp.com/developers/documentation/v3)
- [Highcharter](https://jkunst.com/highcharter/)
### Overall distribution of customer reviews across Chicago Restaurants
```{r}
df_chicago <- df_good[grepl('\\Chicago', df_good$city),]
hchart(df_chicago, "scatter", hcaes(x = review_count, y = rating, z = review_count, group = name))
```
***
Chicago's Pizza Restaurants Inference Points
- Chicago's Pequod's Pizzeria has 6k reviews with 4 rating, followed by Lou Molnati's Pizzeria
- Coalfire Pizza has most rating with 4.5 with 1k reviews
\
References :
- [Yelp API](https://www.yelp.com/developers/documentation/v3)
- [Highcharter](https://jkunst.com/highcharter/)
### Location Markers across Bangalore for Pizza Delivery Store featuring Zomato Ratings
```{r}
leaflet(pizza_blr) %>%
addTiles() %>%
addCircles(lng =as.numeric(pizza_blr$longitude), lat = as.numeric(pizza_blr$latitude), weight = 2,
radius = ~sqrt(as.numeric(pizza_blr$votes))*7, popup=paste(pizza_blr$name,":",pizza_blr$locality," , rating :",pizza_blr$aggregate_rating," votes : ",pizza_blr$votes)
)
```
***
Inference Points :
- BTM Layout in Bangalore is rocking it ! With 4.2 rating and 15k votes.
- Soulspace in Marthalli needs to up their game, 3.1 rating around 5k votes.
\
References :
- [Zomato API](https://developers.zomato.com)
- [leaflet visual](http://rstudio.github.io/leaflet/shapes.html)
### Overall distribution of Reviews across different localities in Bangalore, India with average customer rating
```{r}
hchart(pizza_blr, "scatter", hcaes(x = as.numeric(votes), y = as.numeric(aggregate_rating), z = as.numeric(aggregate_rating), group = locality))
```
***
Inference Points :
- BTM Layout in Bangalore is rocking it ! With 4.2 rating and 15k votes.
- Soulspace in Marthalli needs to up their game, 3.1 rating around 5k votes.
\
References :
- [Zomato API](https://developers.zomato.com)
- [Highcharter](https://jkunst.com/highcharter/)
### Location Markers across Sydney Australia for Pizza Delivery Store featuring Zomato Ratings
```{r}
leaflet(pizza_blr) %>%
addTiles() %>%
addCircles(lng =as.numeric(pizza_aus$longitude), lat = as.numeric(pizza_aus$latitude), weight = 2,
radius = ~sqrt(as.numeric(pizza_aus$votes))*7, popup=paste(pizza_aus$name,":",pizza_aus$locality," , rating :",pizza_aus$aggregate_rating," votes : ",pizza_aus$votes)
)
```
***
Inference Points :
- Sydney Olympic Park seems to be leading ratings 3.4 with 18 reviews.
- Store in Mascot was rated at 2.5 with 22 reviews.
\
References :
- [Zomato API](https://developers.zomato.com)
- [leaflet visual](http://rstudio.github.io/leaflet/shapes.html)
### Overall distribution of Reviews across different localities in Sydney, Australia with average customer rating
```{r}
hchart(pizza_aus, "scatter", hcaes(x = as.numeric(votes), y = as.numeric(aggregate_rating), z = as.numeric(aggregate_rating), group = locality))
```
### Detail Yelp Data around reviews and ratings for stores across Midwest Metro City Areas
```{r}
datatable(df_good)
```